// import mutations from './mutations'
// import Vue from 'vue'
// import state from './state'

export default {
  // 手机号输入
  telephone_input({ commit  }) {
    console.log('telephone_input////')
    commit('TELEPHONE_INPUT')
  },
  // 关闭遮罩
  close_mask({ commit }) {
    commit('CLOSE_MASK')
  },
  // 菜单切换 active
  switch_nav({ commit }, index) {
    commit('SWITCH_NAV', index)
  },
  // 菜单切换
  switch_navList({ commit }) {
    commit('SWITCH_NAVLIST')
  },
  //选址
  show_suggest({ commit }, key) {
    commit('SHOW_SUGGEST', key)
  },
  // 关闭选址
  close_suggest({ commit }) {
    commit('CLOSE_SUGGEST')
  },
  switch_input_city({ commit }) {
    commit('SWITCH_INPUT_CITY')
  },
  // 关闭定位错误提示
  close_location_error({ commit }) {
    commit('CLOSE_LOCATION_ERROR')
  },

  // 手机正则
  check_telephone({ commit }, telephone) {
    commit('CHECK_TELEPHONE', telephone)
  },
  // 验证码
  toMessageConfirm({ commit }, telephone) {
    commit('TOMESSAGECONFIRM', telephone)
  },
  // 验证码倒计时
  // time({ commit, state }, value) {
  //   state.tips = value
  //   state.timeCount = true
  //   state.tipsContent = `${state.tips}秒后重发`
  //   // Interval = null
  //   console.log(state.Interval)
  //   clearInterval(state.Interval)
  //   state.Interval = setInterval(() => {
  //     state.tips--
  //     if (state.tips < 1) {
  //       state.timeCount = false
  //       clearInterval(state.Interval)
  //     } else {
  //       state.tipsContent = `${state.tips}秒后重发`
  //     }
  //   }, 1000)
  // },
  // // 下单呼叫倒计时
  // time_order({ commit, state }, value) {
  //   clearInterval(state.Interval)
  //   state.Interval = setInterval(() => {
  //     value--
  //     state.tipsContent = `${value}`
  //   }, 1000)
  // },

  // 保存手机号至本地
  save_telephone({ commit }) {
    commit('SAVE_TELEPHONE')
  },
  // 首次加载确认用户登录
  get_telephone({ commit }) {
    commit('GET_TELEPHONE')
  },
  // 关闭侧边栏
  close_usersidebar({ commit }) {
    console.log('actions///')
    commit('CLOSE_USERSIDEBAR')
  },
  //选择地址
  choose_address({ commit }, index) {
    commit('CHOOSER_ADDRESS', index)
    commit('CLOSE_SUGGEST')
  },
  close_autocompletelist({ commit }) {
    commit('CLOSE_AUTOCOMPLETELIST')
  }
}
